<?php
/*
	Class to perform the various actions for the site
*/

class MineCobalt_Site{
	
	function __construct(){
		global $sql, $tpl, $config;
		
		if(!$config){
			/*
				Include and define config variables
			*/
			include('system/settings/main.config.php');
		}
		
		if(!$sql){
			/*
				Include and define mysql connection
			*/
			include('system/classes/mysql.class.php');
		}
		
		if(!$tpl){
			/*
				Include and define smarty
			*/
			include('system/classes/smarty/Smarty.class.php');
			$tpl = new Smarty;
			$tpl->setTemplateDir($config['theme']['templatedir']);
			$tpl->setCompileDir($config['theme']['templatecompile']);
			$tpl->setCacheDir($config['theme']['templatecache']);
		}
		
		
	}
	function getpage() {
		global $sql, $tpl, $config;
		if(!empty($_GET['page'])){
			$pagename = $_GET['page'];
		}else{
			$pagename = 'index';
		}
		$tpl->display($pagename.'.tpl');
	}
}
?>